//---------------------------------------------------------------------------------
#include "CCase.h"
#include "CMur.h"
#include "CCaisse.h"
#include "CEmplacement.h"
//---------------------------------------------------------------------------------
void CCase::draw(QPainter *painter, int x, int y, int step, bool selected) {
	CCaisse *c=CCaisse::getInstance();
	
	if(caseType == ectMur) {
		CMur::getInstance()->draw(painter, x, y, step);
	}else if(caisse && emplacement) {
		c->setOk(true);
		c->draw(painter, x, y, step);
	}else if(caisse) {
		c->setOk(false);
		c->draw(painter, x, y, step);
	}else if(emplacement) {
		CEmplacement::getInstance()->draw(painter, x, y, step);
	}
	
	if(selected) {
		QPen pen(Qt::DotLine);
		
		pen.setColor(Qt::black);
		pen.setWidth(2);
		
		painter->setBrush(Qt::NoBrush);
		painter->setPen(pen);
		painter->drawRoundedRect(QRect(x, y, SPRITE_WIDTH-1, SPRITE_HEIGHT-1), 0, 0);
		
		painter->setBrush(Qt::white);
		painter->setPen(Qt::white);
	}
}
//---------------------------------------------------------------------------------